#pragma once
#include "DXAMLCommon.h"
#include "XamlNamespace.h"
#include "XamlQualifiedObject.h"
#include "XamlType.h"
#include "XamlProperty.h"
#include "CompressedObjectWriterStack.h"
#include "INameScope.h"


class ObjectWriterFrame
{
private: 
	xshared_ptr<XamlQualifiedObject> m_qoValue;
	xshared_ptr<XamlQualifiedObject> m_qoCollection;
	xshared_ptr<XamlQualifiedObject> m_qoInstance;
	xshared_ptr<CompressedObjectWriterStack> m_spCompressedStack;
	xshared_ptr<XamlType> m_spType;
	xshared_ptr<XamlProperty> m_spMember;
	xshared_ptr<xpairlist<xshared_ptr<XamlProperty>,xshared_ptr<XamlQualifiedObject> > > m_spDirectiveValuesMap;
	xref_ptr<INameScope> m_spNameScope;
	xshared_ptr<xstringmap<xshared_ptr<XamlNamespace> > > m_Namespaces;
	xshared_ptr<xvector<xshared_ptr<XamlProperty> > > m_spAssignedProperties;
	xshared_ptr<xpairlist<xshared_ptr<XamlProperty>,xshared_ptr<XamlQualifiedObject> > > m_spReplacementPropertyValues;
	struct  
	{
		XUINT32 m_fWasAssignedAtCreation:1;
		XUINT32 m_fIsObjectFromMember:1;
	};


	HRESULT EnsureDirectives();
public: 
	ObjectWriterFrame();
	ObjectWriterFrame(const ObjectWriterFrame & source);
	HRESULT Clone(ObjectWriterFrame &);
	virtual HRESULT AddNamespacePrefix(const xshared_ptr<CXString> & inPrefix, const xshared_ptr<XamlNamespace> & spXamlNamespace);
	virtual HRESULT FindNamespaceByPrefix(const xshared_ptr<CXString> & inPrefix, xshared_ptr<XamlNamespace> & rspXamlNamespace);
	HRESULT get_Directives(xshared_ptr<xpairlist<xshared_ptr<XamlProperty>,xshared_ptr<XamlQualifiedObject> > > & spDirectives);
	XBOOL exists_Directives();
	XBOOL contains_Directive(const xshared_ptr<XamlProperty> & inProperty);
	HRESULT tryget_Directive(const xshared_ptr<XamlProperty> & inProperty, xshared_ptr<XamlQualifiedObject> & outInstance);
	HRESULT add_Directive(const xshared_ptr<XamlProperty> & inProperty, const xshared_ptr<XamlQualifiedObject> & inInstance);
	XBOOL exists_CompressedStack() const;
	xshared_ptr<CompressedObjectWriterStack> & get_CompressedStack();
	xshared_ptr<CompressedObjectWriterStack> & get_CompressedStack() const;
	HRESULT ensure_CompressedStack();
	XBOOL get_IsPropertyAssigned(const xshared_ptr<XamlProperty> & inProperty);
	HRESULT NotifyPropertyAssigned(const xshared_ptr<XamlProperty> & inProperty);
	const xshared_ptr<XamlType> & get_Type() const;
	XBOOL exists_Type() const;
	void set_Type(const xshared_ptr<XamlType> & spType);
	const xshared_ptr<XamlProperty> & get_Member() const;
	XBOOL exists_Member() const;
	void clear_Member();
	void set_Member(const xshared_ptr<XamlProperty> & spMember);
	const xshared_ptr<XamlQualifiedObject> & get_Instance() const;
	XBOOL exists_Instance() const;
	void clear_Instance();
	void set_Instance(const xshared_ptr<XamlQualifiedObject> & qoInstance);
	const xshared_ptr<XamlQualifiedObject> & get_Collection();
	void clear_Collection();
	void set_Collection(const xshared_ptr<XamlQualifiedObject> & qoCollection);
	const xshared_ptr<XamlQualifiedObject> & get_Value();
	XBOOL exists_Value() const;
	void set_Value(const xshared_ptr<XamlQualifiedObject> & qoValue);
	XBOOL exists_ReplacementPropertyValues() const;
	const xshared_ptr<xpairlist<xshared_ptr<XamlProperty>,xshared_ptr<XamlQualifiedObject> > > & get_ReplacementPropertyValues() const;
	void set_ReplacementPropertyValues(const xshared_ptr<xpairlist<xshared_ptr<XamlProperty>,xshared_ptr<XamlQualifiedObject> > > & spReplacementPropertyValues);
	HRESULT GetAndRemoveReplacementPropertyValue(const xshared_ptr<XamlProperty> & spProperty, xshared_ptr<XamlQualifiedObject> & qoValue);
	XBOOL get_WasAssignedAtCreation() const;
	void set_WasAssignedAtCreation(XBOOL value);
	class xref_ptr<INameScope> get_NameScope() const;
	void set_NameScope(const xref_ptr<INameScope> &);
	XBOOL get_IsObjectFromMember() const;
	void set_IsObjectFromMember(XBOOL value);



};




